#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>

int main() {
  FILE *fd;
  char buf[1000];
  char numbers[]={'1','2','3','4','5','6','7','8','9','0'};
  int i;
  printf("This is a writer to test tracing basic read/write operations\n");
  while (1) {
    fd = fopen ("./testfile.txt", "w");
    if (fd==NULL) {
      perror("error opening file");
      return -1;
    }
    for (i=0;i<10000000;i++) {
      fwrite(numbers,1, sizeof(numbers), fd);
    }
    fclose(fd);
    fd = fopen ("./testfile.txt", "r");
    if (fd==NULL) {
      perror("error opening file");
      return -1;
    }
    while (!feof(fd)) {
      fgets(buf,1000-2,fd);
    }
    fclose(fd);
  }
  return 0;
}
